﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="ZX.Web.UI.Controls.DataGrid" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
           
    <link href="/SFramework/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
    <link href="/SFramework/ztree/css/demo.css" rel="stylesheet" />
    <script src="/SFramework/jquery-1.6.2.min.js"></script>
    <script src="/SFramework/ztree/js/jquery.ztree.all-3.3.min.js"></script>
    <style type="text/css">
        body {
            padding-left: 0px;
            font-size: 13px;
        }
    </style>
</head>
<body>
    <ul  class='ztree' id="tree1"url="/extendpage/data/jsondata.aspx?entity=<%=GetStringFromQueryString("masterentity","t_base_department") %>&condition=<%=GetStringFromQueryString("master_condition","") %>&type=1" style="width: 100%;"
        showtreeicon="true" textfield="name" idfield="id" parentfield="parent_id" resultastree="false" expandonload="true">
    </ul>

</body>
    
    <script type="text/javascript">
        /* 树 */
        var setting = {
            edit: {
                drag: {
                    autoExpandTrigger: true,
                    prev: dropPrev,
                    inner: dropInner,
                    next: dropNext
                },
                enable: true,
                showRemoveBtn: false,
                showRenameBtn: false,
                editNameSelectAll: false

            },
            data: {
                key: {
                    title: "t"
                },
                simpleData: {
                    enable: true,
                    idKey: "id",
                    pIdKey: "parent_id"
                }
            },
            callback: {
                beforeClick: beforeClick,
                onClick: onClick,
                beforeDrag: beforeDrag,
                beforeDrop: beforeDrop,
                beforeDragOpen: beforeDragOpen,
                onDrag: onDrag,
                onDrop: onDrop,
                onExpand: onExpand
            }
        };


        var log, className = "dark";
        function beforeClick(treeId, treeNode, clickFlag) {
            className = (className === "dark" ? "" : "dark");
            return (treeNode.click != false);
        }

        var _treeNode = null;
        function onClick(event, treeId, treeNode, clickFlag) {
            var id = treeNode.id;
            _treeNode = treeNode;
        }

        function beforeDragOpen(treeId, treeNode) {
        }

        function beforeDrag(treeId, treeNodes) {
        }
        function beforeDrop(treeId, treeNodes, targetNode, moveType) {
        }

        function dropPrev(treeId, nodes, targetNode) {
        }
        function dropInner(treeId, nodes, targetNode) {
        }
        function dropNext(treeId, nodes, targetNode) {
        }

        function onDrag(event, treeId, treeNodes) {
        }
        function onDrop(event, treeId, treeNodes, targetNode, moveType, isCopy) {
}
        function onExpand(event, treeId, treeNode) {
        }

        $(document).ready(function () {

            $.get($("#tree1").attr("url"),
                function (d, t) {
                    var data = eval("(" + d + ")");
                    var _temp = [];
                    $.each(data, function (e) {
                        _temp.push($.extend(data[e], { drag: true }));
                    });
                    $.fn.zTree.init($("#tree1"), setting, _temp);
                });
        });

    </script>
    <script src="/Scripts/common/jquery.action.js"></script>
    <script src="/Scripts/common/jquery.data.js"></script>
    <script src="/SFramework/jquery.json-2.2.js"></script>
</html>
